/**
 * Author:yuiop
 * Date:2022/3/17 17:10
 */
package com.devops.admin.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.devops.admin.model.DOSCluster;
import com.devops.admin.po.DOSClusterNamespacePo;
import com.devops.admin.po.DOSClusterPo;
import com.devops.admin.po.DOSProjectEnvClusterNamespaceRelationPo;
import com.devops.admin.vo.DOSK8sIngressVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface DOSClusterMapper extends BaseMapper<DOSCluster> {

    List<DOSProjectEnvClusterNamespaceRelationPo> getCascade();

    String getHelmChartUrl(@Param("clisterId") int clisterId);

    /**
     * @Author heyabo
     * @Description 根据releaseId
     * @Date 14:08 2022/4/29
     * @Param [releaseId]
     * @return java.lang.String
     **/
    String getHelmWrapperApiUrlByRelease(@Param("releaseId") int releaseId);

    /**
     * @Author heyabo
     * @Description 查询集群信息
     * @Date 13:48 2022/4/28
     * @Param [clusterPage, cluster]
     * @return void
     **/
    List<DOSClusterPo> getClusters(Page<DOSCluster> clusterPage, @Param("param") DOSCluster cluster);

    /**
     * @Author heyabo
     * @Description 查询所有集群信息
     * @Date 13:48 2022/4/28
     * @Param [clusterPage, cluster]
     * @return void
     **/
    List<DOSClusterPo> getClusters(@Param("param") DOSCluster cluster);

    /**
     * @Author heyabo
     * @Description 获取helmUrl
     * @Date 14:39 2022/6/30
     * @Param [projectId]
     * @return java.lang.String
     **/
    String getOldHelmUrl(Long projectId);

    /**
     * @Author heyabo
     * @Description 查询集群和命名空间的级联 - 非管理员
     * @Date 09:12 2022/7/22
     * @Param []
     * @return java.util.List<com.devops.admin.po.DOSClusterNamespacePo>
     **/
    List<DOSClusterNamespacePo> getClusterNamespaces(String userId);

    /**
     * @Author heyabo
     * @Description //TODO 
     * @Date 14:59 2022/9/29
     * @Param [projectIds]
     * @return java.util.List<com.devops.admin.po.DOSClusterNamespacePo>
     **/
    List<DOSClusterNamespacePo> getClusterNamespacesByProjectIds(List<Integer> projectIds);

    /**
     * @Author heyabo
     * @Description 根据集群id和命名空间id查询集群，命名空间，clusterInfo的信息
     * @Date 09:21 2022/9/30
     * @Param [ingressVo]
     * @return java.util.List<com.devops.admin.po.DOSClusterPo>
     **/
    List<DOSClusterPo> getClusterAndNamespaceAndClusterInfo(@Param("param") DOSK8sIngressVo ingressVo);

    /**
     * @Author heyabo
     * @Description 根据集群id和命名空间id查询集群，命名空间，clusterInfo的信息
     * @Date 09:21 2022/9/30
     * @Param [ingressVo]
     * @return java.util.List<com.devops.admin.po.DOSClusterPo>
     **/
    List<DOSClusterPo> getClusterAndNamespaceAndClusterInfos(@Param("param") DOSK8sIngressVo ingressVo,List<Integer> projectIds);
}
